<!DOCTYPE html>
<html>
<head>
  <title>3dp Cart</title>
  <meta charset="utf-8">
  <meta name="Author" content="3dp Inc.">
  <meta name="viewport" content="width=1024">
  <meta name="revisit-after" content="15 days">
  <meta name="language" content="zn">
  <meta name="copyright" content="">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="canonical" href="/cart/">
	<link rel="stylesheet" type="text/css" href="/rrstatic/stylesheets/screen.css?tag=<?echo $tag?>"/>
	<link rel="stylesheet" type="text/css" href="/rrstatic/styles/jquery/jquery-ui-1.8.18.custom.css?tag=<?echo $tag?>">
	<link rel="stylesheet" type="text/css" href="/rrstatic/styles/jquery/jquery.selectbox.css?tag=<?echo $tag?>">
	
	<script type="text/javascript" src="/rrstatic/javascript/jquerys.min.js?tag=<?echo $tag?>"></script>
	<script type="text/javascript" src="/rrstatic/javascript/shared.jquery.js?tag=<?echo $tag?>"></script>
	<script type="text/javascript" src="/rrstatic/javascript/portal/shapewaysApp.jquery.js?tag=<?echo $tag?>"></script>
	<!--[if lte IE 7]>
    <link rel="stylesheet" href="/rrstatic/javascript/fancybox/source/jquery.fancybox.css?tag=<?echo $tag?>" type="text/css" media="screen">
  	<script type="text/javascript" src="/rrstatic/javascript/fancybox/source/jquery.fancybox.js?tag=<?echo $tag?>" defer="defer"></script>
    <script type="text/javascript">
        $(document).ready(function() {
        $(".fancybox").fancybox();
        $("#browser-redirect").fancybox().trigger('click');
        SW.track('ie7-beware', { });
      });
    </script>
    <div style="display:none;">
      <div id="browser-redirect" style="width:600px; position:relative;">
        <div style="margin:10px auto; text-align:center;"><img border="0" style="width: 163px; " alt="Logo" src="/rrstatic/img/sw-logo-dark.png"></div>
        <h2><strong>Hello.</strong></h2>
        <p>We're sorry to inform you that we no longer support this browser and can't confirm that everything will work as expected. For the best Spuser3D experience, please use one of the following browsers:</p>
        <p>
          <ul class="support-list">
            <li>Get <a href="https://www.google.com/intl/en/chrome/browser/">Google Chrome</a></li>
            <li>Get <a href="http://www.mozilla.org/en-US/firefox/new/">Firefox</a></li>
            <li>Get <a href="http://windows.microsoft.com/en-us/internet-explorer/download-ie">Internet Explorer</a> latest version</li>
          </ul>
        </p>

        <small><em>Click anywhere outside this window to continue.</em></small>
      </div>
    </div>
  <![endif]-->
  <link rel="stylesheet" href="/rrstatic/javascript/fancybox/source/jquery.fancybox.css?tag=<?echo $tag?>" type="text/css" media="screen">
  <script type="text/javascript" src="/rrstatic/javascript/fancybox/source/jquery.fancybox.js?tag=<?echo $tag?>" defer="defer"></script>
</head>
<body class="sct-cart ">
<input type="hidden" name="targetUrl" value="<?php echo $targetUrl?>">
<input type="hidden" name="cart_step" value="1"/>
	<div class="">
	  <?php include APPPATH . 'views/head.php';?>
		<!-- ADD TO CART POPUP -->
		<script>
		  $('#addtocart_popup_container').prependTo('#header').show();
		  function close_addtocart_popup() {
		    var pop = document.getElementById('addtocart_popup_container');
		    pop.style.display = 'none';
		  }
		</script>
		<!-- END ADD TO CART POP UP -->
	  	<div class=" clearfix ">
		<?php 
		if(0 == $cart_count || 0 == count($cart_count)){
		?>
		<!-- cart is empty -->
		    <div id="incart-empty-container" class="container" style="margin:100px auto;">
		        <div class="span-5" style="text-align: right;">
		            <img src="/rrstatic/img/checkout/empty-cart-icon.png" alt="Empty Cart">
		        </div>
		        <div class="span-6 last" style="padding: 20px 0 0 0;">
		            <h3>您的购物车是空的。</h3>
		            <p>
		            	浏览<a href="/page/gallery.php">产品</a>，将您喜欢的添加到购物车。
		            </p>
		        </div>
		    </div>
		<?php
		}else{
		?>
		<!-- cart is not empty -->
		<script type="text/javascript" src="/rrstatic/javascript/modelmaterialselector2.js?tag=<?echo $tag?>"></script>
		<script type="text/javascript" src="/rrstatic/javascript/utils.js?tag=<?echo $tag?>"></script>
		<script type="text/javascript" src="/rrstatic/javascript/pricing.js?tag=<?echo $tag?>"></script>
		<!-- begin container area -->
		<div class="container">
		    <?php 
			if($is_login){
			?>
		    <div class="checkout_breadcrumbs checkout_breadcrumb_4">
		        <div class="checkout_breadcrumb checkout_breadcrumb_active" id="breadcrumb-cart">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title" style="height: 50px">
		                    我的购物车
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_wb">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-confirmation">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                    填写核对订单信息
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_b">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-payment">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                   支付订单
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_b">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-receipt">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                    下单成功
		                </div>
		            </div>
		            <div class="clearfixfix">
		            </div>
		        </div>
		        <div class="clearfixfix"></div>
		    </div>
		    <?php
			}else{
			?>
		    <div class="checkout_breadcrumbs checkout_breadcrumb_5">
		        <div class="checkout_breadcrumb checkout_breadcrumb_active" id="breadcrumb-cart">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title" style="height: 50px">
		                    我的购物车
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_wb">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-login">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                    注册/登录
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_b">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-confirmation">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                   填写核对订单信息
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_b">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-payment">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                    支付订单
		                </div>
		            </div>
		            <div class="checkout_breadcrumb_img">
		                <div class="checkout_breadcrumb_img_b">
		                </div>
		            </div>
		        </div>
		        <div class="checkout_breadcrumb " id="breadcrumb-receipt">
		            <div class="checkout_breadcrumb_text">
		                <div class="checkout_breadcrumb_title">
		                    下单成功
		                </div>
		            </div>
		            <div class="clearfixfix">
		            </div>
		        </div>
		        <div class="clearfixfix">
		        </div>
		    </div>
		    <?php
			}
			?>
		    <div style="clear:left;height:1px;">&nbsp;</div>
		    <div id="incart" class="span-12 last">
		        <div class="headline-container clearfix">
		            <div class="span-9">
		                <h1>
		                    <label class="currency">
		                        Subtotal:
		                    </label>
		                    <span class="subtotal">¥37.87</span></h1>
		            </div>
		            <!-- Next Shipping Button -->
		            <div class="span-3 last">
		                <?php 
	                		if($is_login)
	                			echo '<a href="/cart/confirm">
											<div class="action-button block">
												下一步: <span>核对订单</span> »
											</div>
										</a>
										';
	                		else 
	                    		echo '<a href="/cart/login">
											<div class="action-button block">
												 下一步: <span>登录</span> »
											</div>
										</a>
										';
	                	?>
		            </div>
		            <!-- /Next Shipping Button -->
		        </div>
		        <div id="incart-items-container" class="box" style="padding-bottom:0;">
		            <div id="item-header" class="clearfix">
		                <div class="col1 col "><label>模型</label></div>
					    <div class="col2 col "></div>
					    <div class="col3 col "><label>数量</label></div>
					    <div class="col4 col "><label>小计(元)</label></div>
		            </div>
		            <!-- item loop  -->
		            <div class="item first clearfix" id="item-975070-31">
					    <div class="checkout-thumb col1 col">
					        <a href="/model/975070?li=cart"><img src="/mstatic/model/picture/118x87_975070_918379_1365098898.jpg" width="118" height="87" /></a>
					    </div>
					    <div class="col2 col">
					        <span class="item-name"><a href="/model/975070/?li=cart&materialId=31">Layer Ring(s) (US Size6.5)</a></span>
					        <div>
					            <div class="item-material materialImage">
					                <img src="/rrstatic/img/materials/metal_gold_matt.jpg" />
					            </div>
					            <div class="material-info">
					                <span class="materialName"><a href="javascript:void(0);" onclick="changeMaterial('975070-31')">Gold Plated Matte</a></span>
					                <br/>
					                <span class="unitPrice"><strong>¥32.64 </strong></span>
					                <br/>
					            </div>
					        </div>
					    </div>
					    <div class="col3 col">
					        <input type="text" class="quantity" onkeyup="updateQuantity('975070-31', this)" id="quantity_975070-31" value="4" />
					        <div class="item-action-links">
					            <a style="font-size: 12px;" href="javascript:void(0);" onclick="removeItem('975070-31')">Remove</a>
					        </div>
					    </div>
					    <div class="col4 col">
					        <strong><span class="itemSubtotal"><strong>¥130.56</strong></span>
					            <br/>
					        </strong>
					    </div>
					</div>
					<hr class="item-divider" id="item-975070-31-divider" />
					<div class="item first clearfix" id="item-24470-6">
					    <div class="checkout-thumb col1 col">
					        <a href="/model/24470?li=cart"><img src="/mstatic/model/picture/118x87_24470_88337_1338413385.jpg" width="118" height="87" /></a>
					    </div>
					    <div class="col2 col">
					        <span class="item-name"><a href="/model/24470/?li=cart&materialId=6">Gyroid</a></span>
					        <div>
					            <div class="item-material materialImage">
					                <img src="/rrstatic/img/materials/plastic_wsf_white.jpg" />
					            </div>
					            <div class="material-info">
					                <span class="materialName"><a href="javascript:void(0);" onclick="changeMaterial('24470-6')">White Strong & Flexible</a></span>
					                <br/>
					                <span class="unitPrice"><strong>¥16.99 </strong></span>
					                <br/>
					            </div>
					        </div>
					    </div>
					    <div class="col3 col">
					        <input type="text" class="quantity" onkeyup="updateQuantity('24470-6', this)" id="quantity_24470-6" value="1" />
					        <div class="item-action-links">
					            <a style="font-size: 12px;" href="javascript:void(0);" onclick="removeItem('24470-6')">Remove</a>
					        </div>
					    </div>
					    <div class="col4 col">
					        <strong><span class="itemSubtotal"><strong>$16.99</strong></span>
					            <br/>
					        </strong>
					    </div>
					</div>
					<hr class="item-divider" id="item-24470-6-divider" />
					<div class="item first clearfix" id="item-970914-27">
					    <div class="checkout-thumb col1 col">
					        <a href="/model/24470?li=cart"><img src="/mstatic/model/picture/674x501_466063_159690_1338413389.jpg" width="118" height="87" /></a>
					    </div>
					    <div class="col2 col">
					        <span class="item-name"><a href="/model/24470/?li=cart&materialId=6">Yumo</a></span>
					        <div>
					            <div class="item-material materialImage">
					                <img src="/rrstatic/img/materials/plastic_wsf_white.jpg" />
					            </div>
					            <div class="material-info">
					                <span class="materialName"><a href="javascript:void(0);" onclick="changeMaterial('970914-27')">White Strong & Flexible</a></span>
					                <br/>
					                <span class="unitPrice"><strong>¥18.99 </strong></span>
					                <br/>
					            </div>
					        </div>
					    </div>
					    <div class="col3 col">
					        <input type="text" class="quantity" onkeyup="updateQuantity('970914-27', this)" id="quantity_970914-27" value="1" />
					        <div class="item-action-links">
					            <a style="font-size: 12px;" href="javascript:void(0);" onclick="removeItem('970914-27')">Remove</a>
					        </div>
					    </div>
					    <div class="col4 col">
					        <strong><span class="itemSubtotal"><strong>$16.99</strong></span>
					            <br/>
					        </strong>
					    </div>
					</div>
					<hr class="item-divider" id="item-970914-27-divider" />
					<div class="item first clearfix" id="item-691978-60">
					    <div class="checkout-thumb col1 col">
					        <a href="/model/691978?li=cart"><img src="/mstatic/model/picture/118x87_691978_996573_1368265561.jpg" width="118" height="87" /></a>
					    </div>
					    <div class="col2 col">
					        <span class="item-name"><a href="/model/691978/?li=cart&materialId=60">Thee spoon Eragatory</a></span>
					        <div>
					            <div class="item-material materialImage">
					                <img src="/rrstatic/img/materials/fd_thumb.jpg" />
					            </div>
					            <div class="material-info">
					                <span class="materialName"><a href="javascript:void(0);" onclick="changeMaterial('691978-60')">Frosted Detail</a></span>
					                <br/>
					                <span class="unitPrice"><strong>¥17.51 </strong></span>
					                <br/>
					            </div>
					        </div>
					    </div>
					    <div class="col3 col">
					        <input type="text" class="quantity" onkeyup="updateQuantity('691978-60', this)" id="quantity_691978-60" value="1" />
					        <div class="item-action-links">
					            <a style="font-size: 12px;" href="javascript:void(0);" onclick="removeItem('691978-60')">Remove</a>
					        </div>
					    </div>
					    <div class="col4 col">
					        <strong><span class="itemSubtotal"><strong>¥17.51</strong></span>
					            <br/>
					        </strong>
					    </div>
					</div>
		            <!-- End: item loop -->
		            <div id="item-subtotal-row">&nbsp;</div>
		            <div class="clearfix">
		            	<div class="col col1">&nbsp;</div>
						<div class="col col2">&nbsp;</div>
						<div class="col col3"><label>商品总价：</label></div>
						<div class="col col4">
							<strong><span class="subtotalNoShipping">¥34.28</span></strong>
						</div>
		            </div>
		            <div class="clearfix">
		                <div class="col item_col_1_2">&nbsp;</div>
		                <div class="col item_col_3_4">
		                    <div>
		                        <div class="col col3 margin-top-small"><label>运费金额：</label></div>
		                        <div class="col col4 margin-top-small">
		                            <strong><span class="shippingCost">¥3.00</span></strong>
		                        </div>
		                    </div>
		                </div>
		            </div>
		            <div class="clearfix">
		                <div class="col item_col_1_2">&nbsp;</div>
	      				<div class="col col3 label">应付总额：</div>
		                <div class="col col4">
		                    <div class="price"><strong><span class="subtotal">¥54.27</span></strong></div>
		                </div>
		            </div>
		            <div id="item-total-row" class="total-row clearfix">
		                <div class="span-9">
		                    <h1 style="padding:0 0 10px 0;"><span class="currency">Will ship by</span><span class="targetShipDate">July 9th</span><a href="javascript: void(0);" ref="info_shipping" name="info" class="infotip popup-dialog">i</a></h1>
		                </div>
		                <div class="span-3 last">
		                	 <?php 
		                		if($is_login)
		                			echo '<a href="/cart/confirm">
												<div class="action-button block">
													 下一步: <span>核对订单</span> »
												</div>
											</a>
											';
		                		else 
		                    		echo '<a href="/cart/login">
												<div class="action-button block">
													 下一步: <span>登录</span> »
												</div>
											</a>
											';
		                	?>
		                </div>
		                <div style="height:100%;">&nbsp;</div>
		            </div>
		        </div>
		    </div>
		</div>
		<!-- end container area -->
		<!-- begin material-select -->
		<div class="material-select" id="info_targetShipDate" style='display: none;'>
		    <div class="infoDialog-inner">
		    </div>
		</div>
		<div class="material-select" id="info_taxShippingNotIncluded" style='display: none;'>
		    <div class="infoDialog-inner">
		    </div>
		</div>
		<div class="material-select" id="info_shipping">
		    <div class="infoDialog-inner">
		        <h2>运费价格表</h2>
		        （以1公斤计算）
		        <br>
		        <br>
		        <table>
		            <tbody>
		                <tr valign="top">
		                    <td>
		                        <strong>收费标准</strong>
		                        <br>
		                    </td>
		                    <td>
		                        <strong>地区</strong>
		                    </td>
		                </tr>
		                <tr>
		                    <td>
		                        首重16元，续重6元
		                    </td>
		                    <td>
		                        河南、安徽、江苏、上海、湖北、浙江、江西、湖南、福建、四川、重庆、贵州、广西、云南、海南
		                    </td>
		                </tr>
		                <tr>
		                    <td>
		                        首重16元，续重7元
		                    </td>
		                    <td>
		                        北京、天津、河北、山东、山西
		                    </td>
		                </tr>
		                <tr>
		                    <td>
		                        首重17元，续重12元
		                    </td>
		                    <td>
		                        辽宁、吉林、黑龙江、新疆、西藏、内蒙古、、陕西、宁夏、甘肃、青海
		                    </td>
		                </tr>
		            </tbody>
		        </table>
		    </div>
		</div>
		<div class="material-select" id="selectMaterialOverlay">
		    <!-- the external content is loaded inside this tag -->
		    <div class="infoDialog-inner" id="selectMaterialContent">
		    </div>
		</div>
		<!-- end material-select  -->
		<script type="text/javascript">
		var ajaxRequest = null;
		function changeMaterial(itemKey){
		    var info = $('#selectMaterialContent').html('<div class="loader"><img src="/rrstatic/img/loading.gif" alt="Loading" /></div>');
		    info.dialog({
		        resizable: false,
		        autoOpen: true,
		        modal: true,
		        title: 'Select Material',
		        height: 500,
		        width: '638px'
		    });
		    
		    jQuery('.ui-widget-overlay').click(function(){
		        info.dialog("close");
		    });
		    ajaxRequest = $.get('/ajax/cart.php?method=updateCartItemMaterial', {
		        itemKey: itemKey
		    }, function(response){
		        $("#selectMaterialContent").html(response);
		        $('#materialSelect').show();
		    });
		}

		function removeItem(itemKey){
		    var inputField = jQuery("#item-" + itemKey + " .quantity").first();
		    inputField.val(0);
		    updateQuantity(itemKey);
		}

		function updateQuantity(itemKey){
		    if (ajaxRequest) {
		        ajaxRequest.abort();
		        ajaxRequest = null;
		    }
		    var itemKeyParts = itemKey.split('-');
		    var itemId = itemKeyParts[0];
		    var materialId = itemKeyParts[1];
		    var inputField = jQuery("#item-" + itemKey + " .quantity").first();
		    var quantity = inputField.val();
		    
		    var data = {
		        itemId: itemId,
		        materialId: materialId,
		        quantity: quantity
		    };
		    // Don't delete the item if they clear the box to type something new in.
		    if (quantity.length !== 0) {
		        ajaxRequest = jQuery.post('/ajax/cart.php?method=updateItemQuantity', data, function(response){
		            data = jQuery.parseJSON(response);
		            updateCartDisplay(data);
		        });
		    }
		}

		function updateShippingCountry(dropdown){
		    if (ajaxRequest) {
		        ajaxRequest.abort();
		        ajaxRequest = null;
		    }
		    var data = {
		        countryId: jQuery(dropdown).val()
		    };
		    ajaxRequest = jQuery.post('/ajax/cart.php?method=updateShippingCountry', data, function(response){
		        data = jQuery.parseJSON(response);
		        updateCartDisplay(data);
		    });
		}

		function updateCartDisplay(data){
		    var count = 0;
		    
		    var remaining = [];
		    for (var i in data.templateModelData.cart.items) {
		        remaining.push('item-' + i);
		        var item = data.templateModelData.cart.items[i];
		        count += parseInt(item.quantity);
		        
		        jQuery("#item-" + i + " .quantity").val(item.quantity);
		        if (data.templateModelData.items != undefined) {
		            jQuery("#item-" + i + " .itemSubtotal").html(data.templateModelData.items[i].subtotal);
		            jQuery("#item-" + i + " .unitPrice").html(data.templateModelData.items[i].unitPrice);
		            if (jQuery("#item-" + i + " .materialName a").length > 0) {
		                jQuery("#item-" + i + " .materialName").html('<a onclick="changeMaterial(\'' + i + '\')" href="javascript:void(0);">' + data.templateModelData.items[i].materialName + '</a>');
		            }
		            else {
		                jQuery("#item-" + i + " .materialName").html(data.templateModelData.items[i].materialName);
		            }
		            //console.log("item[#item-" + i + " .materialImage]: " + data.templateModelData.items[i].materialImage);
		            jQuery("#item-" + i + " .materialImage").html(data.templateModelData.items[i].materialImage);
		        }
		        
		    }
		    if (count == 0 || isNaN(count)) {
		        window.location.href = window.location.href;
		        return;
		    }
		    
		    // remove item from list if it's not part of return json.
		    jQuery('.item').each(function(){
		        if (jQuery.inArray(jQuery(this).attr('id'), remaining) != -1) { // in array
		        }
		        else { // not in array
		            jQuery(this).remove();
		            jQuery('#' + jQuery(this).attr('id') + '-divider').remove();
		        }
		    });
		    
		    jQuery("#cartcount").html(count);
		    jQuery(".grandTotal").replaceWith(data.htmlData.grandTotal);
		    jQuery(".appliedTax").replaceWith(data.htmlData.appliedTax);
		    jQuery(".taxPercentage").replaceWith(data.htmlData.taxPercentage);
		    jQuery(".shippingCost").replaceWith(data.htmlData.shippingCost);
		    jQuery(".subtotal").replaceWith(data.htmlData.subtotal);
		    jQuery(".subtotalNoShipping").replaceWith(data.htmlData.subtotalNoShipping);
		    jQuery(".includeTax").replaceWith(data.htmlData.includeTax);
		    jQuery(".targetShipDate").replaceWith(data.htmlData.targetShipDate);
		    
		    jQuery(".showVATNote").replaceWith(data.htmlData.showVATNote);
		}

		jQuery(document).ready(function(){
		    jQuery('.popup-dialog').each(function(){
		        jQuery(this).bind('click', function(event){
		            event.preventDefault();
		            var inf = jQuery('#' + jQuery(this).attr('ref')).html();
		            showDialogText(inf, 'Information', true, '640px', '');
		        });
		    });
		});
		SW.track('funnel_cart_view', {});
		</script>
		<?php
		}
		?>
		</div>
	  	<!-- begin bottom.tpl -->
	  	<?php include APPPATH . 'views/footer.php';?>
		<!-- LEGAL -->
		<?php include APPPATH . 'views/footer_legal.php';?>
	</div>
</body>
</html>